package tech.aistar.corejava.day14.exercise;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 豆梦寒 on 2019/8/2.
 */
public class TestProduct {
    public static void main(String[] args) {
       // List<Product> list = new ArrayList<>();
        Product p1 = new Product(1, "小米", 10.00, "河南");
        Product p6 = new Product(6, "小米", 10.00, "河南");
        Product p2 = new Product(2, "大米", 10.00, "河南");
        Product p3 = new Product(3, "绿豆", 20.00, "河南");
        Product p4 = new Product(4, "劳斯莱斯魅影", 3000000.00, "劳斯莱斯汽车公司");
        Product p7 = new Product(7, "劳斯莱斯魅影", 3000000.00, "劳斯莱斯汽车公司");
        Product p5 = new Product(5, "劳斯莱斯魅影星空版", 5000000.00, "劳斯莱斯汽车公司");

        //list.add(p1);
        //list.add(p2);

        IProductDao productDao = new ProductDaoImpl();
        productDao.save(p1);
        productDao.save(p2);
        productDao.save(p3);
        productDao.save(p4);
       // List<Product>list = productDao.findAll();

        //productDao.delByname("大米");

        List<Product> list = productDao.findAll();

        if (null != list) {
            list.forEach(System.out::println);

        }else {
            System.out.println("文件读取失败");
        }
    }
}
